package com.heima.reggie.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.heima.reggie.bean.OrderDetail;
import com.heima.reggie.mapper.OrderDetailMapper;
import com.heima.reggie.service.OrderDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class OrderDetailServiceImpl implements OrderDetailService {
    @Autowired
    private OrderDetailMapper mapper;
    @Override
    public int add(OrderDetail orderDetail) {
        return mapper.insert(orderDetail);
    }

    @Override
    public int counByOid(Long id) {
        return mapper.selectCount(new LambdaQueryWrapper<OrderDetail>().eq(OrderDetail::getOrderId,id));
    }
}
